package com.example.myapplication

fun main() {
    val res=makingString(24)
    println(res)

    val price=toPrice("zz")
    println(price)

    val grade=getGrade(95)
    println(grade)
}

fun makingString(age: Int):String{
    if(age<6){
        return "玩泥巴"
    }else if(age>=6&&age<18){
        return "学习"
    }else{
        return "工作"
    }
}

fun toPrice(food: String):Number{
    val price=when(food){
        "zz"->10
        "xx"->15
        "cc"->20
        else->0
    }
    return price
}

fun getGrade(score: Number): String{
    return when(score){
        in 0..59->"不及格"
        in 60..69->"及格"
        in 70 until 89->"良好"
        in 90..100->"优秀"
        else -> "输入有误"
    }
}